{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "# Building Noise Models"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Introduction\n",
    "\n",
    "This notebook introduces how to use the Qiskit Aer `noise` module to build custom noise models for noisy simulations."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-08-19T17:00:43.403378Z",
     "start_time": "2019-08-19T17:00:41.139269Z"
    }
   },
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "from qiskit import QuantumCircuit, transpile\n",
    "from qiskit.quantum_info import Kraus, SuperOp\n",
    "from qiskit_aer import AerSimulator\n",
    "from qiskit.visualization import plot_histogram\n",
    "\n",
    "# Import from Qiskit Aer noise module\n",
    "from qiskit_aer.noise import (NoiseModel, QuantumError, ReadoutError, \n",
    "    pauli_error, depolarizing_error, thermal_relaxation_error)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Qiskit Aer Noise Module\n",
    "\n",
    "The Qiskit Aer `noise` module contains Python classes to build customized noise models for simulation. There are three key classes:\n",
    "\n",
    "1. The `NoiseModel` class which stores a noise model used for noisy simulation.\n",
    "2. The `QuantumError` class which describes CPTP gate errors. These can be applied:\n",
    "    * After *gate* or *reset* instructions\n",
    "    * Before *measure* instructions.\n",
    "\n",
    "3. The `ReadoutError` class which describes classical readout errors."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Quantum Errors\n",
    "\n",
    "Rather than deal with the `QuantumError` object directly, many helper functions exist to automatically generate a specific type of parameterized quantum error. These are contained in the `noise` module and include functions for many common errors types used in quantum computing research. The function names and the type of error they return are:\n",
    "\n",
    "| Standard error function | Details |\n",
    "| --- | --- |\n",
    "| `kraus_error` | a general n-qubit CPTP error channel given as a list of Kraus matrices $[K_0, ...]$. |\n",
    "| `mixed_unitary_error` | an n-qubit mixed unitary error given as a list of unitary matrices and probabilities $[(U_0, p_0),...]$. |\n",
    "| `coherent_unitary_error` | an n-qubit coherent unitary error given as a single unitary matrix $U$. |\n",
    "| `pauli_error` | an n-qubit Pauli error channel (mixed unitary) given as a list of Pauli's and probabilities $[(P_0, p_0),...]$ |\n",
    "| `depolarizing_error` | an n-qubit depolarizing error channel parameterized by a depolarization probability $p$. |\n",
    "| `reset_error` | a single-qubit reset error parameterized by a probabilities $p_0, p_1$ of resetting to the $|0\\rangle$, $|1\\rangle$ state.|\n",
    "| `thermal_relaxation_error` | a single qubit thermal relaxation channel parameterized by relaxation time constants $T_1$, $T_2$, gate time $t$, and excited state thermal population $p_1$. |\n",
    "| `phase_amplitude_damping_error` | A single-qubit generalized combined phase and amplitude damping error channel given by an amplitude damping parameter $\\lambda$, a phase damping parameter $\\gamma$, and an excited state thermal population $p_1$. |\n",
    "| `amplitude_damping_error` |  A single-qubit generalized amplitude damping error channel given by an amplitude damping parameter $\\lambda$, and an excited state thermal population $p_1$. |\n",
    "| `phase_damping_error` |  A single-qubit phase damping error channel given by a phase damping parameter $\\gamma$ |\n",
    "\n",
    "### Combining quantum errors\n",
    "\n",
    "`QuantumError` instances can be combined by using composition, tensor product, and tensor expansion (reversed order tensor product) to produce new `QuantumErrors` as:\n",
    "\n",
    " * Composition: $\\cal{E}(\\rho)=\\cal{E_2}(\\cal{E_1}(\\rho))$ as `error = error1.compose(error2)`\n",
    " * Tensor product: $\\cal{E}(\\rho) =(\\cal{E_1}\\otimes\\cal{E_2})(\\rho)$ as `error error1.tensor(error2)`\n",
    " * Expand product: $\\cal{E}(\\rho) =(\\cal{E_2}\\otimes\\cal{E_1})(\\rho)$ as `error error1.expand(error2)`"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Example\n",
    "\n",
    "For example to construct a 5% single-qubit Bit-flip error:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-08-19T17:00:43.420358Z",
     "start_time": "2019-08-19T17:00:43.416062Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "QuantumError on 1 qubits. Noise circuits:\n",
      "  P(0) = 0.05, Circuit = \n",
      "   ┌───┐\n",
      "q: ┤ X ├\n",
      "   └───┘\n",
      "  P(1) = 0.95, Circuit = \n",
      "   ┌───┐\n",
      "q: ┤ I ├\n",
      "   └───┘\n",
      "QuantumError on 1 qubits. Noise circuits:\n",
      "  P(0) = 0.05, Circuit = \n",
      "   ┌───┐\n",
      "q: ┤ Z ├\n",
      "   └───┘\n",
      "  P(1) = 0.95, Circuit = \n",
      "   ┌───┐\n",
      "q: ┤ I ├\n",
      "   └───┘\n"
     ]
    }
   ],
   "source": [
    "# Construct a 1-qubit bit-flip and phase-flip errors\n",
    "p_error = 0.05\n",
    "bit_flip = pauli_error([('X', p_error), ('I', 1 - p_error)])\n",
    "phase_flip = pauli_error([('Z', p_error), ('I', 1 - p_error)])\n",
    "print(bit_flip)\n",
    "print(phase_flip)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-08-19T17:00:43.435843Z",
     "start_time": "2019-08-19T17:00:43.432211Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "QuantumError on 1 qubits. Noise circuits:\n",
      "  P(0) = 0.0025000000000000005, Circuit = \n",
      "   ┌───┐┌───┐\n",
      "q: ┤ X ├┤ Z ├\n",
      "   └───┘└───┘\n",
      "  P(1) = 0.0475, Circuit = \n",
      "   ┌───┐┌───┐\n",
      "q: ┤ X ├┤ I ├\n",
      "   └───┘└───┘\n",
      "  P(2) = 0.0475, Circuit = \n",
      "   ┌───┐┌───┐\n",
      "q: ┤ I ├┤ Z ├\n",
      "   └───┘└───┘\n",
      "  P(3) = 0.9025, Circuit = \n",
      "   ┌───┐┌───┐\n",
      "q: ┤ I ├┤ I ├\n",
      "   └───┘└───┘\n"
     ]
    }
   ],
   "source": [
    "# Compose two bit-flip and phase-flip errors\n",
    "bitphase_flip = bit_flip.compose(phase_flip)\n",
    "print(bitphase_flip)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-08-19T17:00:43.460191Z",
     "start_time": "2019-08-19T17:00:43.456782Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "QuantumError on 2 qubits. Noise circuits:\n",
      "  P(0) = 0.0025000000000000005, Circuit = \n",
      "     ┌───┐\n",
      "q_0: ┤ X ├\n",
      "     ├───┤\n",
      "q_1: ┤ Z ├\n",
      "     └───┘\n",
      "  P(1) = 0.0475, Circuit = \n",
      "     ┌───┐\n",
      "q_0: ┤ I ├\n",
      "     ├───┤\n",
      "q_1: ┤ Z ├\n",
      "     └───┘\n",
      "  P(2) = 0.0475, Circuit = \n",
      "     ┌───┐\n",
      "q_0: ┤ X ├\n",
      "     ├───┤\n",
      "q_1: ┤ I ├\n",
      "     └───┘\n",
      "  P(3) = 0.9025, Circuit = \n",
      "     ┌───┐\n",
      "q_0: ┤ I ├\n",
      "     ├───┤\n",
      "q_1: ┤ I ├\n",
      "     └───┘\n"
     ]
    }
   ],
   "source": [
    "# Tensor product two bit-flip and phase-flip errors with\n",
    "# bit-flip on qubit-0, phase-flip on qubit-1\n",
    "error2 = phase_flip.tensor(bit_flip)\n",
    "print(error2)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Converting to and from QuantumChannel operators\n",
    " \n",
    "We can also convert back and forth between `QuantumError` objects in Qiskit Aer and `QuantumChannel` objects in Qiskit Terra."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-08-19T17:00:43.482424Z",
     "start_time": "2019-08-19T17:00:43.473779Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Kraus([[[ 9.74679434e-01+0.j,  0.00000000e+00+0.j],\n",
      "        [-1.20234617e-16+0.j,  9.74679434e-01+0.j]],\n",
      "\n",
      "       [[ 2.62045272e-16+0.j,  2.23606798e-01+0.j],\n",
      "        [ 2.23606798e-01+0.j, -2.84112242e-16+0.j]]],\n",
      "      input_dims=(2,), output_dims=(2,))\n"
     ]
    }
   ],
   "source": [
    "# Convert to Kraus operator\n",
    "bit_flip_kraus = Kraus(bit_flip)\n",
    "print(bit_flip_kraus)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-08-19T17:00:43.509521Z",
     "start_time": "2019-08-19T17:00:43.503976Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "SuperOp([[1. +0.j, 0. +0.j, 0. +0.j, 0. +0.j],\n",
      "         [0. +0.j, 0.9+0.j, 0. +0.j, 0. +0.j],\n",
      "         [0. +0.j, 0. +0.j, 0.9+0.j, 0. +0.j],\n",
      "         [0. +0.j, 0. +0.j, 0. +0.j, 1. +0.j]],\n",
      "        input_dims=(2,), output_dims=(2,))\n"
     ]
    }
   ],
   "source": [
    "# Convert to Superoperator\n",
    "phase_flip_sop = SuperOp(phase_flip)\n",
    "print(phase_flip_sop)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-08-19T17:00:43.794037Z",
     "start_time": "2019-08-19T17:00:43.778223Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "QuantumError on 1 qubits. Noise circuits:\n",
      "  P(0) = 1.0, Circuit = \n",
      "   ┌───────┐\n",
      "q: ┤ kraus ├\n",
      "   └───────┘\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Convert back to a quantum error\n",
    "print(QuantumError(bit_flip_kraus))\n",
    "\n",
    "# Check conversion is equivalent to original error\n",
    "QuantumError(bit_flip_kraus) == bit_flip"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Readout Error\n",
    "\n",
    "Classical readout errors are specified by a list of assignment probabilities vectors $P(A|B)$:\n",
    "\n",
    "  * $A$ is the *recorded* classical bit value\n",
    "  * $B$ is the *true* bit value returned from the measurement \n",
    " \n",
    "E.g. for 1 qubits: $ P(A|B) = [P(A|0), P(A|1)]$."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-08-19T17:00:44.659598Z",
     "start_time": "2019-08-19T17:00:44.654818Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "ReadoutError([[0.95 0.05]\n",
       " [0.1  0.9 ]])"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Measurement miss-assignement probabilities\n",
    "p0given1 = 0.1\n",
    "p1given0 = 0.05\n",
    "\n",
    "ReadoutError([[1 - p1given0, p1given0], [p0given1, 1 - p0given1]])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Readout errors may also be combined using `compose`, `tensor` and `expand` like with quantum errors."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Adding errors to a Noise Model\n",
    "\n",
    "When adding a quantum error to a noise model we must specify the type of *instruction* that it acts on, and what qubits to apply it to. There are two cases for Quantum Errors:\n",
    " \n",
    " 1. All-qubit quantum error\n",
    " 2. Specific qubit quantum error\n",
    "  \n",
    "### 1. All-qubit quantum error\n",
    "\n",
    "This applies the same error to any occurrence of an instruction, regardless of which qubits it acts on.\n",
    "\n",
    "It is added as `noise_model.add_all_qubit_quantum_error(error, instructions)`:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-08-19T17:00:45.882254Z",
     "start_time": "2019-08-19T17:00:45.877630Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "NoiseModel:\n",
      "  Basis gates: ['cx', 'id', 'rz', 'sx', 'u1', 'u2', 'u3']\n",
      "  Instructions with noise: ['u3', 'u2', 'u1']\n",
      "  All-qubits errors: ['u1', 'u2', 'u3']\n"
     ]
    }
   ],
   "source": [
    "# Create an empty noise model\n",
    "noise_model = NoiseModel()\n",
    "\n",
    "# Add depolarizing error to all single qubit u1, u2, u3 gates\n",
    "error = depolarizing_error(0.05, 1)\n",
    "noise_model.add_all_qubit_quantum_error(error, ['u1', 'u2', 'u3'])\n",
    "\n",
    "# Print noise model info\n",
    "print(noise_model)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 2. Specific qubit quantum error\n",
    "\n",
    "This applies the error to any occurrence of an instruction acting on a specified list of qubits. Note that the order of the qubit matters: For a 2-qubit gate an error applied to qubits [0, 1] is different to one applied to qubits [1, 0] for example.\n",
    "\n",
    "It is added as `noise_model.add_quantum_error(error, instructions, qubits)`:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-08-19T17:00:46.615959Z",
     "start_time": "2019-08-19T17:00:46.612055Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "NoiseModel:\n",
      "  Basis gates: ['cx', 'id', 'rz', 'sx', 'u1', 'u2', 'u3']\n",
      "  Instructions with noise: ['u3', 'u2', 'u1']\n",
      "  Qubits with noise: [0]\n",
      "  Specific qubit errors: [('u1', (0,)), ('u2', (0,)), ('u3', (0,))]\n"
     ]
    }
   ],
   "source": [
    "# Create an empty noise model\n",
    "noise_model = NoiseModel()\n",
    "\n",
    "# Add depolarizing error to all single qubit u1, u2, u3 gates on qubit 0 only\n",
    "error = depolarizing_error(0.05, 1)\n",
    "noise_model.add_quantum_error(error, ['u1', 'u2', 'u3'], [0])\n",
    "\n",
    "# Print noise model info\n",
    "print(noise_model)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Note on non-local qubit quantum error\n",
    "\n",
    "`NoiseModel` does not support addition of non-local qubit quantum errors. They should be handled outside of `NoiseModel`. That suggests you should write your own transpiler pass (`TransformationPass`) and run the pass just before running the simulator if you need to insert your quantum errors into your circuit under your own conditions. See `noise.passes.LocalNoisePass` for example of how to implement such a transpiler pass."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Executing a noisy simulation with a noise model\n",
    "\n",
    "The command `AerSimulator(noise_model=noise_model)` returns a simulator configured to the given noise model. In addition to setting the simulator's noise model, it also overrides the simulator's basis gates, according to the gates of the noise model."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "subslide"
    }
   },
   "source": [
    "## Noise Model Examples\n",
    "\n",
    "We will now give some examples of noise models. For our demonstrations we will use a simple test circuit generating a n-qubit GHZ state:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-08-19T17:00:48.817405Z",
     "start_time": "2019-08-19T17:00:48.806966Z"
    },
    "slideshow": {
     "slide_type": "fragment"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "        ┌───┐                ░ ┌─┐         \n",
      "   q_0: ┤ H ├──■─────────────░─┤M├─────────\n",
      "        └───┘┌─┴─┐           ░ └╥┘┌─┐      \n",
      "   q_1: ─────┤ X ├──■────────░──╫─┤M├──────\n",
      "             └───┘┌─┴─┐      ░  ║ └╥┘┌─┐   \n",
      "   q_2: ──────────┤ X ├──■───░──╫──╫─┤M├───\n",
      "                  └───┘┌─┴─┐ ░  ║  ║ └╥┘┌─┐\n",
      "   q_3: ───────────────┤ X ├─░──╫──╫──╫─┤M├\n",
      "                       └───┘ ░  ║  ║  ║ └╥┘\n",
      "meas: 4/════════════════════════╩══╩══╩══╩═\n",
      "                                0  1  2  3 \n"
     ]
    }
   ],
   "source": [
    "# System Specification\n",
    "n_qubits = 4\n",
    "circ = QuantumCircuit(n_qubits)\n",
    "\n",
    "# Test Circuit\n",
    "circ.h(0)\n",
    "for qubit in range(n_qubits - 1):\n",
    "    circ.cx(qubit, qubit + 1)\n",
    "circ.measure_all()\n",
    "print(circ)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Ideal Simulation"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-08-19T17:00:50.560988Z",
     "start_time": "2019-08-19T17:00:50.415545Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAcgAAAFLCAYAAABShRycAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/P9b71AAAACXBIWXMAAAsTAAALEwEAmpwYAAAdIElEQVR4nO3de5xdZX3v8c/PDA7BJJoEk5ALDkguhkA0jI1Dx6BiKGqrzbFHLV7QVrBW8ND22L7aamu1FERrqfS0CoWC1rZalcvBFhEl5IymwUlKIAGT0CQ0wVzMBZPQOJj4O3+sPek4PLlMMjN7Lp/367Vf7FnPWnv/5kVWvlnPep5nRWYiSZJ+1nPqXYAkSQORASlJUoEBKUlSgQEpSVKBASlJUoEBKUlSQUO9C+hPp556ajY1NdW7DEnSALF8+fIdmfnCUtuwCsimpiba29vrXYYkaYCIiCcO12YXqyRJBQakJA0iTU1NnHPOObz0pS+lubkZgA996EPMmjWLc889l0WLFvHUU08BsHPnTl796lczatQorrjiijpWPTgZkJI0yNx///089NBDh24ZLVy4kFWrVvHwww8zY8YMrrnmGgBOPvlkPv7xj/OpT32qnuUOWgakJA1yF110EQ0N1ZCSV7ziFWzevBmA5z3vebS2tnLyySfXs7xBy4CUpEEkIrjooos477zzuPHGG5/Vfsstt/C6172uDpUNPcNqFKskDXZtbW1MmTKF7du3s3DhQmbNmsWCBQsAuPrqq2loaODtb397nascGryClKRBZMqUKQBMmDCBRYsW8eCDDwJw6623cvfdd/PFL36RiKhniUOGASlJg8TTTz/N3r17D72/9957mTNnDvfccw/XXXcdd911F6ecckqdqxw67GKVpEFi27ZtLFq0CIADBw5wySWXcPHFF3PWWWfR0dHBwoULgWqgzmc/+1mgmhayZ88ennnmGe644w7uvfdeZs+eXbffYTCJzKx3Df2mubk5XUlHktQpIpZnZnOpzS7WYa406XjXrl0sXLiQ6dOns3DhQnbv3g3AnXfeybnnnnto37a2tnqWLkl9yoDUsyYdX3vttVx44YWsW7eOCy+8kGuvvRaACy+8kJUrV/LQQw9xyy238N73vreeZUtSnzIg9Sx33nknl156KQCXXnopd9xxBwCjRo06NDru6aefdqScpCHNgBzmSpOOt23bxmmnnQbApEmT2LZt26H9b7/9dmbNmsUb3vAGbrnllrrULEn9wVGsw1xp0nFXEfEzV4qLFi1i0aJFLFmyhI985CPcd999/V2yJPULryCHudKk44kTJ7JlyxYAtmzZwoQJE5513IIFC1i/fj07duzo13olqb8YkMPY4SYdv/GNb+S2224D4LbbbuNNb3oTAI8//jid04JWrFhBR0cH48ePr0/xktTH7GIdxg436fjlL385b3nLW7j55pt50YtexJe//GUAvvrVr/L5z3+ek046iZEjR/KlL33JgTqShiwXCpAkDVsuFCBJUg8ZkJIkFRiQkiQVGJCSJBU4ilXSkHbZ9fWuQH3lpqv69vO9gpQkqcCAlCSpwICUJKnAgJQkqcCAlCSpwICUJKnAgJQkqcB5kD3knKqhq6/nVEkaXLyClCSpwICUJKnAgJQkqcCAlCSpwICUJKnAgJQkqcCAlCSpwICUJKnAgJQkqcCAlCSpwICUJKnAgJQkqcCAlCSpwICUJKnAgJQkqcCAlCSpwICUJKnAgJQkqcCAlCSpwICUJKmgbgEZEb8fERkRf9Vl2621bV1f/9btuMaIuCEidkTE0xFxV0RM7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E/X2vaCgTwhcz8aF2Kk/QstekbmZk/7rr4eOcguoi4Gnh9Zr6sXjUOFc6DHIYiYgLwTqr1G3cA+6m6UtuATwEnUd3fuCcz19apTEkFmbm/MxgLcx9PAd4M/F09ahtqvIIchmqra5wN/F9gF1X36jnADGA78OHuS1dJqq/ayNS9R5puVXu4wFuBf3SAzokzIIeZ2r8891J1wSzpsu10YD7VPYwzgbdk5oq6FSrpZ0TE56hGrz5INQdyT2GfF2TmU/1d21DlKNbhZzawgWqKB1Bbqyrzicz8MvBLVN2t/7M+5UnqLiJ+leqxVX8O3Ek1rWNRRLy4dk+y897kbZ3TtnTivIIcZmon0d3AKcC7gP/IzJ922+dK4Ncz86X9X6Gk7iLiJuAgcB3V0zkuBV4MrAH+BfgW1YMF/jIzn1uvOocaryCHmdojb/4QGAl8HnhXREyLiFFw6Cb/BcCq+lUpqVNENFD1+jyVmesz81OZeQ7wcqqn7FxKNUXrBqqHDKiXeAU5TNW6YT4CvJHqCR5LgR9SrcW6BXhvZj5SvwoldYqIscDEzPx+bbWrn3QdrBMRbwX+EZiXmQ/Vqcwhx4Ac5mpTPt4A/DLVsnKrgH/OzO/Xsy5JR1Zb8Soy82BEXEbVvXpKvesaSgxIHRIRz+l+P1LSwBcRvw2MyMxP1ruWocSAlKRBrvYIrIP+A7d3GZCSJBU4ilWSpAIDUpKkAgNSkqQCA1KSpAIDUpKkAgNSkqSC/w8y2syX7VjnUAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 504x360 with 1 Axes>"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Ideal simulator and execution\n",
    "sim_ideal = AerSimulator()\n",
    "result_ideal = sim_ideal.run(circ).result()\n",
    "plot_histogram(result_ideal.get_counts(0))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "slideshow": {
     "slide_type": "subslide"
    }
   },
   "source": [
    "## Noise Example 1: Basic bit-flip error noise model\n",
    "\n",
    "Lets consider a simple toy noise model example common in quantum information theory research:\n",
    "\n",
    "* When applying a single qubit gate, flip the state of the qubit with probability `p_gate1`.\n",
    "* When applying a 2-qubit gate apply single-qubit errors to each qubit.\n",
    "* When resetting a qubit reset to 1 instead of 0 with probability `p_reset`.\n",
    "* When measuring a qubit, flip the state of the qubit with probability `p_meas`."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-08-19T17:00:51.543615Z",
     "start_time": "2019-08-19T17:00:51.536564Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "NoiseModel:\n",
      "  Basis gates: ['cx', 'id', 'rz', 'sx', 'u1', 'u2', 'u3']\n",
      "  Instructions with noise: ['reset', 'measure', 'u3', 'u1', 'cx', 'u2']\n",
      "  All-qubits errors: ['reset', 'measure', 'u1', 'u2', 'u3', 'cx']\n"
     ]
    }
   ],
   "source": [
    "# Example error probabilities\n",
    "p_reset = 0.03\n",
    "p_meas = 0.1\n",
    "p_gate1 = 0.05\n",
    "\n",
    "# QuantumError objects\n",
    "error_reset = pauli_error([('X', p_reset), ('I', 1 - p_reset)])\n",
    "error_meas = pauli_error([('X',p_meas), ('I', 1 - p_meas)])\n",
    "error_gate1 = pauli_error([('X',p_gate1), ('I', 1 - p_gate1)])\n",
    "error_gate2 = error_gate1.tensor(error_gate1)\n",
    "\n",
    "# Add errors to noise model\n",
    "noise_bit_flip = NoiseModel()\n",
    "noise_bit_flip.add_all_qubit_quantum_error(error_reset, \"reset\")\n",
    "noise_bit_flip.add_all_qubit_quantum_error(error_meas, \"measure\")\n",
    "noise_bit_flip.add_all_qubit_quantum_error(error_gate1, [\"u1\", \"u2\", \"u3\"])\n",
    "noise_bit_flip.add_all_qubit_quantum_error(error_gate2, [\"cx\"])\n",
    "\n",
    "print(noise_bit_flip)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Executing the noisy simulation"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-08-19T17:00:52.951874Z",
     "start_time": "2019-08-19T17:00:52.687440Z"
    },
    "slideshow": {
     "slide_type": "-"
    }
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAcgAAAFLCAYAAABShRycAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/P9b71AAAACXBIWXMAAAsTAAALEwEAmpwYAAA7N0lEQVR4nO3deXxU5dn/8c9FggENKIuEvZHKHkkMqRGLAbdqXVpB69oWhcetrRatVZ/SRf09lboiorWKtVpt1dq6tEjdyq4IBARF2RSwgOxQtmIk4f79cZ/EYThgZstMku/79ZoX5JyZ61wzZ+Zc59znPvcx5xwiIiKyrybpTkBERCQTqUCKiIiEUIEUEREJoQIpIiISQgVSREQkhAqkiIhIiOx0J1CX2rZt6/Lz89OdhoiIZIi5c+ducs4dGTavURXI/Px8ysvL052GiIhkCDP75EDz1MQqIiISQgWyFlatWsVJJ51Enz596Nu3L2PHjgXg1ltvpVOnThQVFVFUVMTEiRMB2LNnD8OGDeOYY46hd+/ejB49Op3pi4hIHBpVE2u8srOzuffeeykuLmbHjh3079+f0047DYDrr7+eG2+8cZ/nP//881RUVPD+++/z3//+lz59+nDxxRej858iIvWHCmQtdOjQgQ4dOgDQokULevfuzZo1aw74fDNj165dVFZWsnv3bg455BBatmxZV+mKiEgSqIk1RitXruTdd9+ltLQUgAcffJB+/foxfPhwtm7dCsD555/PYYcdRocOHejatSs33ngjrVu3TmfaIiISIxXIGOzcuZPzzjuP+++/n5YtW3LNNdfw8ccfM3/+fDp06MBPfvITAGbPnk1WVhaffvopK1as4N5772X58uVpzl5ERGKhAllLe/bs4bzzzuPSSy9l6NChAOTl5ZGVlUWTJk244oormD17NgB//vOfOeOMM2jatCnt2rXj61//ui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hw7jnnnvIy8vj8ccf5/HHH2fgwIEZtZ7Gjh27z3qaMmUK3bp1Y9y4cfusp71798a8npxznHCCPya55JJL+PnPf16znqpfF896At+7trbWrl2b8O/pYCyTTtCa2edAuXPuhIhpdwBDnHO9zewE/DnKrzjn/h3xnMeBTs650w8Wv6SkxCXaNn7F/bE9f/zI2JdRVVVFSUkJnTp1YsKECZx44ok1R38bNmzguOOO46WXXoo9cD123333UV5ezvbt25kwYQI9evTg5Zdfpnfv3vz2t79l9uzZPPHEE+lOUxqg1atXM2zYMEaNGsV9993HH/7wB44//ng+/vhjAKZPn87o0aOZOHFimjOtO2vWrKFTp05s2LCB0047jXHjxtU0rQ4ePJh77rlnn8EJaqsutq/RzGyucy402UxrYl0LfBg1bRHQNfj/uuDfvKjn5EXMq/fGjh1L7969a/6ePn068+fPZ/78+QwYMIChQ4emMbu6t3r1al555RX+53/+p2aamdXsqW7bto2OHTumK720iW72c84xatQoevToQe/evXnggQfSnGHDMHLkSO666y6aNPGby7Zt21JZWVlzNPjXv/615uiqsQjrz9AQZVqBfAuIbsTuAXwS/H8FvhCeVj3TzJoBJwJv10WCqRZWDKpt376dSZMmce6559Z9YmkUvYECeOyxxzjzzDPp3LkzTz31FLfccksaM0yP6B2pJ554glWrVrF48WIWLVrERRddlMbsGoYJEybQrl07+vfvXzPNzHj22We5/vrrOe6442pGp2osDtSfoSHKtHOQY4C3zWwU8BxwLHAd8DMA55wzs/uBn5nZYmAp8HNgJ/DntGScZNXFoPoLGOmll17ilFNOoWXLlmnILD0iN1DV548BxowZw8SJEyktLeXuu+/mhhtu4LHHHktfonWsekequtkP/Cgpf/7zn2t2JDRKSuLeeust/v73vzNx4kQ+++wztm/fzne/+12efvpppk+fDsDrr7/O0qVL05zpvlLZVLl+/XqGDBkCQGVlJZdccglnnHEGL774Itdeey0bN27krLPOoqioiNdeey22RDJMRhVI59wcMzsXuAP4BfDv4N/fRjztLqA58BDQCpgFfMM5t39FqWcOVAyqPfPMM6FHlrWRjr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GfqDc+5OxU5O7HipQH6JYNSGvviedlvw44segx/2bQPw8wR+JIr95XGPxfcgXA3c7Zx7PYk5N+rYQfyWwI7IDVNwuUsz/OAUBcCuONdnvYtd1zmHPKcZcCHwjIvhxsiKnSJ1fchanx74w/ydQFnUtK/gx2B8Hd+UWKzYicU+SNwu+Cat1/FjpSYz50YbOyLeI8AI/A5OywM8p1X1sht67AzI+YgUrsdGFTsZj7QstL488Hvu73OAOwvgO06U45taFDuB2LWIe0gKc250sYPXX4zv+PAf/PWqj+AHaj+aL+6ukQu8BBzT0GOnIech+AHPq2NXD6NWoNiJxU7Wo84XWJ8ewcr5F/4ane6E3znhWvyAv4qdQOz6mHN9jh28tvraym74m8++jx/d5l18p4iTgWuAzxtD7PqYs2Kn9pGWhdanB7679/xgI3UZvnkrN5h3KPBX/FBZip1g7PqYc32Nje+l+TPgN1HT+wL3489vbsJ3Cvp9Q49dH3NW7NQ/0rLQ+vbAn5h/Dt9bcxO+w8Tj+HsIziLG5hbFblg519fY+Nun9Qr+fwhR59TwHSP2AkWNIXZ9zFmxU/tQL9YYBF3uz8JfHP8ZfiSN512cgxYrdt3HVewvXUYT/IaqysyuwI9ccmhjjV0fc1bs5FGBjFOsdx1Q7MyLq9hfuowb8ANG363Y9TNnxU4wBxVIEQkT3IKoKkU7PfUudn3MWbETzEEFUkREZH9N0p2AiIhIJlKBFBERCaECKSIiEkIFUkREJIQKpIiISAgVSBERkRD/H/dJ6UGN970zAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 504x360 with 1 Axes>"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Create noisy simulator backend\n",
    "sim_noise = AerSimulator(noise_model=noise_bit_flip)\n",
    "\n",
    "# Transpile circuit for noisy basis gates\n",
    "circ_tnoise = transpile(circ, sim_noise)\n",
    "\n",
    "# Run and get counts\n",
    "result_bit_flip = sim_noise.run(circ_tnoise).result()\n",
    "counts_bit_flip = result_bit_flip.get_counts(0)\n",
    "\n",
    "# Plot noisy output\n",
    "plot_histogram(counts_bit_flip)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 2: T1/T2 thermal relaxation\n",
    "\n",
    "Now consider a more realistic error model based on thermal relaxation with the qubit environment:\n",
    "* Each qubit is parameterized by a thermal relaxation time constant $T_1$ and a dephasing time constant $T_2$.\n",
    "* Note that we must have $T_2 \\le 2 T_1$.\n",
    "* Error rates on instructions are determined by gate times and qubit $T_1$, $T_2$ values."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-08-19T17:00:54.577456Z",
     "start_time": "2019-08-19T17:00:54.491018Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "NoiseModel:\n",
      "  Basis gates: ['cx', 'id', 'rz', 'sx', 'u2', 'u3']\n",
      "  Instructions with noise: ['reset', 'measure', 'u3', 'cx', 'u2']\n",
      "  Qubits with noise: [0, 1, 2, 3]\n",
      "  Specific qubit errors: [('reset', (0,)), ('reset', (1,)), ('reset', (2,)), ('reset', (3,)), ('measure', (0,)), ('measure', (1,)), ('measure', (2,)), ('measure', (3,)), ('u2', (0,)), ('u2', (1,)), ('u2', (2,)), ('u2', (3,)), ('u3', (0,)), ('u3', (1,)), ('u3', (2,)), ('u3', (3,)), ('cx', (0, 0)), ('cx', (0, 1)), ('cx', (0, 2)), ('cx', (0, 3)), ('cx', (1, 0)), ('cx', (1, 1)), ('cx', (1, 2)), ('cx', (1, 3)), ('cx', (2, 0)), ('cx', (2, 1)), ('cx', (2, 2)), ('cx', (2, 3)), ('cx', (3, 0)), ('cx', (3, 1)), ('cx', (3, 2)), ('cx', (3, 3))]\n"
     ]
    }
   ],
   "source": [
    "# T1 and T2 values for qubits 0-3\n",
    "T1s = np.random.normal(50e3, 10e3, 4) # Sampled from normal distribution mean 50 microsec\n",
    "T2s = np.random.normal(70e3, 10e3, 4)  # Sampled from normal distribution mean 50 microsec\n",
    "\n",
    "# Truncate random T2s <= T1s\n",
    "T2s = np.array([min(T2s[j], 2 * T1s[j]) for j in range(4)])\n",
    "\n",
    "# Instruction times (in nanoseconds)\n",
    "time_u1 = 0   # virtual gate\n",
    "time_u2 = 50  # (single X90 pulse)\n",
    "time_u3 = 100 # (two X90 pulses)\n",
    "time_cx = 300\n",
    "time_reset = 1000  # 1 microsecond\n",
    "time_measure = 1000 # 1 microsecond\n",
    "\n",
    "# QuantumError objects\n",
    "errors_reset = [thermal_relaxation_error(t1, t2, time_reset)\n",
    "                for t1, t2 in zip(T1s, T2s)]\n",
    "errors_measure = [thermal_relaxation_error(t1, t2, time_measure)\n",
    "                  for t1, t2 in zip(T1s, T2s)]\n",
    "errors_u1  = [thermal_relaxation_error(t1, t2, time_u1)\n",
    "              for t1, t2 in zip(T1s, T2s)]\n",
    "errors_u2  = [thermal_relaxation_error(t1, t2, time_u2)\n",
    "              for t1, t2 in zip(T1s, T2s)]\n",
    "errors_u3  = [thermal_relaxation_error(t1, t2, time_u3)\n",
    "              for t1, t2 in zip(T1s, T2s)]\n",
    "errors_cx = [[thermal_relaxation_error(t1a, t2a, time_cx).expand(\n",
    "             thermal_relaxation_error(t1b, t2b, time_cx))\n",
    "              for t1a, t2a in zip(T1s, T2s)]\n",
    "               for t1b, t2b in zip(T1s, T2s)]\n",
    "\n",
    "# Add errors to noise model\n",
    "noise_thermal = NoiseModel()\n",
    "for j in range(4):\n",
    "    noise_thermal.add_quantum_error(errors_reset[j], \"reset\", [j])\n",
    "    noise_thermal.add_quantum_error(errors_measure[j], \"measure\", [j])\n",
    "    noise_thermal.add_quantum_error(errors_u1[j], \"u1\", [j])\n",
    "    noise_thermal.add_quantum_error(errors_u2[j], \"u2\", [j])\n",
    "    noise_thermal.add_quantum_error(errors_u3[j], \"u3\", [j])\n",
    "    for k in range(4):\n",
    "        noise_thermal.add_quantum_error(errors_cx[j][k], \"cx\", [j, k])\n",
    "\n",
    "print(noise_thermal)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Executing the noisy simulation"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-08-19T17:00:55.689241Z",
     "start_time": "2019-08-19T17:00:55.515394Z"
    }
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAcgAAAFLCAYAAABShRycAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/P9b71AAAACXBIWXMAAAsTAAALEwEAmpwYAAAqxklEQVR4nO3de5xVdb3/8deHGR1RQEHljg2UIBdhHKZoPCNwLNSUTiGdTC3zkphpeenX6frrR53Uk6dSMysjPRaeI6V5O3hJRQGxERsRDJCLcYkhYOImg+Eo+Pn98V1Dm813YAY2e+0N7+fjsR/MrLX2nvfsNezP+n7Xd32XuTsiIiKyq3ZpBxARESlEKpAiIiIRKpAiIiIRKpAiIiIRKpAiIiIRKpAiIiIRpWkHyKfjjjvOy8vL044hIiIF4uWXX17v7sfH1h1SBbK8vJy6urq0Y4iISIEws5UtrVMXq4iISIQKpIiI5NWOHTs45ZRTGDt2LADTpk2jsrKSiooKampqeP311wG47rrrqKiooKKigv79+3PMMcfkNech1cUqIiLpu+222xg4cCBbtmwB4Morr+SRRx5h4MCB/PSnP+V73/se99xzD7fccsvO59x+++288sorec2pFqSIiORNfX09jz32GJ/73Od2LjOzncXyjTfeoGfPnrs977777uP888/PW05QC1JERPLo2muv5eabb6axsXHnsl/+8pecffbZtG/fnk6dOvHiiy/u8pyVK1eyfPlyTj/99LxmVQtyP2X3pZ922mk7+8x79uzJxz/+cQA2bdrEuHHjGDp0KB/4wAeYP39+iqlFRPJv6tSpdO3aleHDh++y/JZbbuHxxx+nvr6eSy65hOuvv36X9VOmTOETn/gEJSUl+YyrFuT+yu5Lf/7553euGz9+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xUVFVRUVPD444+nmFBE9ocKpMg+uvjii3nyySd3W37dddcxd+5c5s6dy9lnn51CMhHJBRVIkX00cuRIunTpknaMg0asRf6Vr3yFk046iaFDhzJu3Dg2b96cXkDiGe+//34GDx5Mu3btqKurSzHdPxTDe1kMVCBFcuwnP/kJQ4cO5dJLL2XTpk1pxykasRb5mDFjmD9/Pq+++ir9+/fnpptuSildEMs4ZMgQHnzwQUaOHJlSqt0Vw3tZDFQgRXLoyiuv5M9//jNz586lR48efPnLX047UtGItcjPOOMMSktLAfjgBz9IfX19GtF2imUcOHAgAwYMSClRXDG8l8WgNO0AIntTXl5Ox44dKSkpobS0tGC6sWK6deu28+vLL7+csWPHppjm4HL33Xdz3nnnpR3joKD3snVUIKUoPPfccxx33HFpx9irNWvW0KNHDwAeeuihXc4Byb674YYbKC0t5cILL0w7StHTe9l6KpCHqFWrVnHRRRexbt06zIwJEyZwzTXXpB2rqJx//vlMnz6d9evX07t3b77zne8wffp05s6di5lRXl7OnXfemXbMXVx66aVMnTqVrl27Mn/+/LTjtMo999zD1KlTmTZtGmaWdpyipveybVQgD1GlpaX88Ic/pLKyksbGRoYPH86YMWMYNGhQ2tF2Y2acccYZmBlXXHEFEyZMSDsSAPfdd99uyy677LIUkrTexRdfzNVXX81FF12UdpRWefLJJ7n55puZMWMGRx55ZNpxiprey7bTIJ1DVI8ePaisrASgY8eODBw4kNWrV6ecKm7WrFnMmTOHJ554gjvuuIOZM2emHaloFfKlKeeffz7V1dUsXryY3r17c9ddd3H11VfT2NjImDFjqKio4POf/3zBZXzooYfo3bs3tbW1nHPOOZx55pmpZmwpZ6G9l8VALUhhxYoVvPLKK4wYMSLtKFG9evUCoGvXrowbN46XXnop70PqL78196856drcv2YxK4YWeSwjwLhx4/KcZM+K4b0sBmpBHuK2bt3K+PHjufXWW+nUqVPacXbz5ptv0tjYuPPrp556SgNfRCQv1II8hL3zzjuMHz+eCy+8kHPPPTftOFHr1q3beXS+fft2LrjgAs4666yUU8n+KJbWuH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2BGFCiCGE1m/af59FmzOyzRHAecB9ntKNposhZzFk3C2PCmTbJK2ERkIXwMyMZScAI4DPEWan+aS7z1HGgzpnb8I5tMsJgw3OTzNnkutOwiUoLxGuM9sS2aazu29K+brXgynnMZ7S9a4ZGQo+ZzFk3E3aJ0GL7UFoRfwJ+GAL68uAOkK3kDIeGjkPL5Cc5xMGN2wmXDN6J2Gi5/cB7ZNtOhBu9nuycu5TznHAezNyNk+HNkQ5iztj7KEWZBslJ5inEqbEugj4s+9+F4cvEm7FVJH/hMWRMcmgnDlkZpMI15XdTCg4nyV8AC0m3F9zGmFi+tvc/XDlVE5l3DNdB9lGHubg/CbhaOfXwEVm1sfMOsDOk8yjCNd3KeMeKGfuJNcULgc2u/syd/+Bu59MuAnxDMIH0m8Jd3CfrJzKqYytkHYTtlgfhEEEvyGMulxPGLxxN2F4+mxS7BoqpozKmdN8nUlu4kvo9rWs9ecRurkqlFM5lXHvD3Wx7qdk+P85hIvc3yK0Iu73AphguVkxZATlPBCSkaHm4fZMlxO6sI5MO1c25cytYshZFBlVIHPHWrjZbyEphoygnAeCmV1PmBT6P9POsifKmVvFkLNQM6pAihwiLNxmaEehF3TlzK1iyFmoGVUgRUREIjSKVUREJEIFUkREJEIFUkREJEIFUkREJEIFUkREJEIFUkREJOL/AzEml04tXgEsAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 504x360 with 1 Axes>"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Run the noisy simulation\n",
    "sim_thermal = AerSimulator(noise_model=noise_thermal)\n",
    "\n",
    "# Transpile circuit for noisy basis gates\n",
    "circ_tthermal = transpile(circ, sim_thermal)\n",
    "\n",
    "# Run and get counts\n",
    "result_thermal = sim_thermal.run(circ_tthermal).result()\n",
    "counts_thermal = result_thermal.get_counts(0)\n",
    "\n",
    "# Plot noisy output\n",
    "plot_histogram(counts_thermal)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-08-19T17:01:16.716582Z",
     "start_time": "2019-08-19T17:01:16.709462Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<h3>Version Information</h3><table><tr><th>Qiskit Software</th><th>Version</th></tr><tr><td><code>qiskit</code></td><td>0.24.0.dev0+dba2eff</td></tr><tr><td><code>qiskit-aer</code></td><td>0.11.2</td></tr><tr><td><code>qiskit-ibmq-provider</code></td><td>0.19.2</td></tr><tr><td><code>qiskit</code></td><td>0.40.0</td></tr><tr><th>System information</th></tr><tr><td>Python version</td><td>3.8.11</td></tr><tr><td>Python compiler</td><td>Clang 12.0.5 (clang-1205.0.22.11)</td></tr><tr><td>Python build</td><td>default, Jul 27 2021 10:46:38</td></tr><tr><td>OS</td><td>Darwin</td></tr><tr><td>CPUs</td><td>8</td></tr><tr><td>Memory (Gb)</td><td>64.0</td></tr><tr><td colspan='2'>Tue Feb 07 10:30:00 2023 JST</td></tr></table>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div style='width: 100%; background-color:#d5d9e0;padding-left: 10px; padding-bottom: 10px; padding-right: 10px; padding-top: 5px'><h3>This code is a part of Qiskit</h3><p>&copy; Copyright IBM 2017, 2023.</p><p>This code is licensed under the Apache License, Version 2.0. You may<br>obtain a copy of this license in the LICENSE.txt file in the root directory<br> of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.<p>Any modifications or derivative works of this code must retain this<br>copyright notice, and modified files need to carry a notice indicating<br>that they have been altered from the originals.</p></div>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import qiskit\n",
    "qiskit.__version__\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.11"
  },
  "varInspector": {
   "cols": {
    "lenName": 16,
    "lenType": 16,
    "lenVar": 40
   },
   "kernels_config": {
    "python": {
     "delete_cmd_postfix": "",
     "delete_cmd_prefix": "del ",
     "library": "var_list.py",
     "varRefreshCmd": "print(var_dic_list())"
    },
    "r": {
     "delete_cmd_postfix": ") ",
     "delete_cmd_prefix": "rm(",
     "library": "var_list.r",
     "varRefreshCmd": "cat(var_dic_list()) "
    }
   },
   "types_to_exclude": [
    "module",
    "function",
    "builtin_function_or_method",
    "instance",
    "_Feature"
   ],
   "window_display": false
  },
  "vscode": {
   "interpreter": {
    "hash": "f8729fd834348017bca17aea688b306f536a675180840f7307eb909fff39c285"
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
